package com.doit.demo01;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class serveTCP {
    public static void main(String[] args) throws IOException {
        System.out.println("服务器接收数据中");
        ServerSocket ss = new ServerSocket(6666);
        Socket server = ss.accept();
        InputStream is = server.getInputStream();
        byte[] bytes = new byte[1024];
        int len =is.read(bytes);
        System.out.println(new String(bytes,0,len));
        is.close();
        server.close();
    }
}
